﻿using AutoMapper;
using CollegeSim.CourseScheduler.Domain.DTO;
using CollegeSim.CourseScheduler.Domain.Services;
using CollegeSim.CourseScheduler.Persistence;
using CollegeSim.CourseScheduler.Presentation.Facade;
using System;
using System.Windows.Forms;

namespace CollegeSim.CourseScheduler.Presentation
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            CreateTypeMaps();
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new FormCourseMenu(new SchedulerFacade(new CourseService(new CourseRepository()), new InstructorService(new InstructorRepository()))));
        }

        // Create type maps for application use
        private static void CreateTypeMaps()
        {
            // Domain
            Mapper.CreateMap<Domain.Entities.Course, CourseDto>();
            Mapper.CreateMap<CourseDto, Domain.Entities.Course>();
            Mapper.CreateMap<Domain.Entities.Instructor, InstructorDto>();
            Mapper.CreateMap<InstructorDto, Domain.Entities.Instructor>();
            // TODO add Student maps

            // Persistence
            Mapper.CreateMap<Persistence.Course, CourseDto>();
            Mapper.CreateMap<CourseDto, Persistence.Course>();
            Mapper.CreateMap<Persistence.Instructor, InstructorDto>();
            Mapper.CreateMap<InstructorDto, Persistence.Instructor>();
            // TODO add Student maps
        }
    }
}
